{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d30530db",
   "metadata": {},
   "source": [
    "SKlearn是一个开源的基于python的机器学习包工具\n",
    "涵盖了几乎所有主流机器学习算法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6e4e0b0e",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LinearRegression\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "be2c4079",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAauUlEQVR4nO3df4xdZZ3H8feX6SAD6zoCEwJTamsk06gVihPEdGOk6BaFQFONQmQXlU3/WLPrurvVNmvWZaPbmu4G2WxW08UfbHChWGrxx8ZKKMaECGS6BSs/uiBI6fCjNVA2wgjT9rt/3HPp/Lg/zr3n13PO+bySZuaeuXPnuWc63/M83+f7PMfcHRERqZYTim6AiIikT8FdRKSCFNxFRCpIwV1EpIIU3EVEKmhB0Q0AOP30033x4sVFN0NEpFR27979W3cfafW1IIL74sWLmZiYKLoZIiKlYmZPtfua0jIiIhWk4C4iUkFdg7uZfcvMDprZr2Yc22xmj5rZL83s+2Y2PONrG8zscTPbZ2arMmq3iIh0EKfn/h3gkjnH7gTe6e7vAv4X2ABgZm8HrgTeEX3Pv5vZQGqtFRGRWLoGd3f/OfDCnGM/dfcj0cN7gYXR51cAt7r7q+7+JPA4cEGK7RURkRjSqJb5NLA1+nyURrBvOhAdm8fM1gJrARYtWpRCM0RE4tmxZ5LNO/fxzOEpzhoeYt2qMVYvbxmqSivRhKqZ/R1wBPhur9/r7lvcfdzdx0dGWpZpioikbseeST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HjGz99bxfJjZWPR/ovnv/8zsr7I+FwruvXsVWOnu5wLnAZeY2YXAV4Hr3f1twIvAtcU1MXefBR6Z8bjO5+Iidz9vRg3zeuAudz8HuCt6XBc3AD9x96XAuTT+j9TufLj7vuj/xHnAu4FXgO+T8blQcO+RN/wuejgY/XNgJbAtOn4TsDr/1uXPzBYClwI3Ro+Nmp6LNq6gcQ6gRufCzN4EvA/4JoC7v+buh6np+ZjhYuDX7v4UGZ8LBfc+RGmIB4CDwJ3Ar4HD7n4kesoBoC534Pga8HngWPT4NOp7Lhz4qZntNrO10bEz3P3Z6PPngDOKaVrulgCHgG9HKbsbzewU6ns+mq4Ebok+z/RcKLj3wd2PRkOshcAFwNJiW1QMM7sMOOjuu4tuSyD+yN3PBz4EfMbM3jfzi96oO65L7fEC4Hzg6+6+HHiZOWmHmp0Pormny4Hvzf1aFudCwT2BaJh5N/BeYNjMmrctXAhMFtWuHK0ALjez3wC30kjH3EA9zwXuPhl9PEgjp3oB8LyZnQkQfTxYXAtzdQA44O73RY+30Qj2dT0f0Ljo/4+7Px89zvRcKLj3yMxGzGw4+nwI+CCNiaK7gY9GT7sGuKOQBubI3Te4+0J3X0xjuLnL3T9BDc+FmZ1iZm9sfg78MfAr4Ac0zgHU5FwAuPtzwNNmNhYduhh4mJqej8hVHE/JQMbnQitUe2Rm76Ix+TFA4+J4m7v/o5m9lUbv9VRgD3C1u79aXEvzZWbvB/7W3S+r47mI3vP3o4cLgP9y96+Y2WnAbcAiGttaf8zdXyiombkys/NoTLSfCDwBfIrob4aanY/ogr8feKu7vxQdy/T/hoK7iEgFKS0jIlJBCu4iIhWk4C4iUkEK7iIiFaTgLiJSQQruIiIVpOAuIlJB/w98F0Ljv/1RUwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(100,)\n"
     ]
    }
   ],
   "source": [
    "# 载入数据\n",
    "data = np.genfromtxt(\"data.csv\",delimiter=\",\")\n",
    "x_data = data[:,0]\n",
    "y_data = data[:,1]\n",
    "plt.scatter(x_data,y_data)\n",
    "plt.show()\n",
    "print(x_data.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "63694fc0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# newaxis是一个插入新维度的函数，且插入的这一维的长度是1\n",
    "x_data = data[:,0,np.newaxis]\n",
    "y_data = data[:,1,np.newaxis]\n",
    "# 创建并拟合模型\n",
    "# class sklearn.linear_model.LinearRegression(fit_intercept=True,normalize=False,copy_X=True,n_jobs=1)\n",
    "'''\n",
    "fit_intercept:布尔型，默认为true\n",
    "     说明：是否对训练数据进行中心化，即是否需要b值，如果为false则不需要\n",
    "normalize:布尔型，默认为flase\n",
    "    说明：是否对数据进行归一化处理\n",
    "copy_X:布尔型，默认为true\n",
    "    说明：是否对X复制，如果选择false，则直接对原数据进行覆盖。（即经过中心化、归一化后，是否把新数据覆盖到原数据上）\n",
    "n_jobs:整形，默认为1\n",
    "    说明：计算时设置的任务个数。如果选择-1代表使用所有的CPU\n",
    "返回值：\n",
    "    coef_：数组型变量， 形状为(n_features,)或(n_targets, n_features)\n",
    "    说明：对于线性回归问题计算得到的feature的系数，即权重向量。如果输入的是多目标问题，则返回一个二维数组(n_targets, n_features)；如果是单目标问题，返回一个一维数组(n_features,)。\n",
    "'''\n",
    "model = LinearRegression()\n",
    "# fit（）对训练集x，y进行训练\n",
    "model.fit(x_data,y_data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "dc7da541",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAAOXRFWHRTb2Z0d2F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k/aWcBzWbWri94HHGdmTwM3EZRjrqCa2wJ3fy58fIGgpnow8LyZ7QYQPr6QXQu7ajWw2t1XhM+XEYR9VbcHBDv9X7r78+HzVLeFwr1NZjbTzKaHX08FjiA4UfRT4MTw2xYAt2bSwC5y94XuPsvd9yQ43PyJu/8tFdwWZvZmM9ux/jVwJPAwcBvBNoCKbAsAd18L/M7M9g4XzQMepaLbI/QJRksykPK20BWqbTKz/QhOfvQQ7Bx/4O7/z8z2Iui97gw8AJzs7huya2l3mdkA8Fl3P7aK2yL8mW8Jn/YC33P3S8xsBvADYDbBtNYnufvLGTWzq8zsAIIT7ZOBJ4FTCf9mqNj2CHf4zwJ7ufur4bJU/28o3EVESkhlGRGRElK4i4iUkMJdRKSEFO4iIiWkcBcRKSGFu4hICSncRURK6P8DPuFEy436LgAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 画图\n",
    "plt.plot(x_data,y_data,'b.')\n",
    "# predict(x) 使用训练得到的估计器对输入为x的集合进行预测\n",
    "plt.plot(x_data,model.predict(x_data),'r')\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
